﻿using Google.GData.Client;
using Loki.Utils;

namespace Luna.Connectors.Google
{
    public class GoogleSettingsManager : LokiObject
    {
        private const string ApplicationName = "Luna";

        private RequestSettings settings;

        public RequestSettings Settings
        {
            get
            {
                if (settings == null)
                {
                    throw BuildError<LokiException>("Connector is not configured");
                }
                else
                {
                    return settings;
                }
            }
        }

        public void Configure(IGoogleSettings data)
        {
            settings = new RequestSettings(ApplicationName, data.Login, data.Password);
        }

        public RequestSettings TestQuery(IGoogleSettings data)
        {
            return new RequestSettings(ApplicationName, data.Login, data.Password);
        }
    }
}